// 自定义
jQuery.extend({
        // 配置
        urlConfig: {
            'host': 'http://localhost:8080/',
            'apiPrefix': 'api.php?api=',
            'api': {
                'clusters': 'service/clusterService/clusters',
                'indices': 'service/indexService/indices',
            }
        },

        // 获取url参数
        getUrlParam: function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg); //匹配目标参数
            return r != null ? decodeURI(r[2]) : '';
        },

        getHost: function (type) {
            return this.urlConfig.host + (type == 'host' ? '' : this.urlConfig.apiPrefix);
        },

        getIndexInfoUrl: function (cluster, index) {
            return this.getHost('host')+ 'index-info.html?cluster=' + cluster + '&index=' + index;
        },

        getClustersUrl: function () {
            return this.getHost() + this.urlConfig.api.clusters;
        },

        getIndicesUrl: function () {
            return this.getHost() + this.urlConfig.api.indices;
        },
    }
);